package bishi.baidu.two;

import java.util.Scanner;

/**
 * @author: 唐小尊
 * @email: 1171702529@qq.com
 * @cate: 2021/09/07 20:46
 */
public class one_one {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[][] nums = new int[N][N];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                nums[i][j] = sc.nextInt();
            }
        }
        for (int i = 0; i < N; i++) {
            for (int ik = 0; ik < K; ik++) {
                for (int j = 0; j < N; j++) {
                    for (int jk = 0; jk < K; jk++) {
                        System.out.print(nums[i][j] + " ");
                    }
                }
                System.out.println();
            }
        }
    }
}
